/* eslint-disable class-methods-use-this */
import {
  get,
  put,
  _delete,
} from '@/lin/plugins/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class Project {
  async getProjectList(page, limit, info) {
    const res = await get(`v1/project?page=${page}&limit=${limit}`, info)
    return res
  }

  async getProjectInfo(id) {
    const res = await get(`v1/project/${id}`)
    return res
  }

  async updateProject(info) {
    const res = await put('v1/project', info)
    return res
  }

  async getProvinceInfo(id) {
    const res = await get(`v1/province/${id}`)
    return res
  }

  async deleteProject(id) {
    const res = await _delete(`v1/project/hatch/${id}`)
    return res
  }

  async deleteProjectComment(id) {
    const res = await _delete(`v1/project/comment/${id}`)
    return res
  }
}

export default new Project()
